<script setup lang="ts">
import { type ApiErrorCodeBo } from '@/api/api-manage/create'
import useDictStore from '@/store/modules/dict'

const dictStore = useDictStore()
defineProps<{
  data: ApiErrorCodeBo[]
}>()
defineEmits(['delete', 'edit'])

const columns: TableColumnList = [
  {
    label: '错误码',
    prop: 'errorCode',
    minWidth: 100,
  },
  {
    label: '错误信息',
    prop: 'errorInfo',
    minWidth: 100,
  },
  {
    label: '错误描述',
    prop: 'errorDesc',
    minWidth: 100,
  },
  {
    label: '操作',
    fixed: 'right',
    width: 140,
    slot: 'operation',
  },
]
</script>

<template>
  <pure-table
    border
    showOverflowTooltip
    align-whole="center"
    table-layout="auto"
    :data="data"
    :columns="columns"
    :header-cell-style="{
      background: 'var(--el-table-row-hover-bg-color)',
      color: 'var(--el-text-color-primary)',
    }"
  >
    <template #operation="{ index }">
      <el-button link class="reset-margin" type="primary" @click="$emit('edit', index)">
        编辑
      </el-button>
      <el-button link type="danger" class="reset-margin" @click="$emit('delete', index)">
        删除
      </el-button>
    </template>
  </pure-table>
</template>
